#!/usr/bin/emacs --script

;; Built for emacs 26.1

;; (setq debug-on-error t)

(add-to-list 'load-path (expand-file-name "../../bin/htmlize"))
(require 'htmlize)
(require 'ox-publish)
;; (require 'ox-rss)

(setq org-html-validation-link nil)
(setq ssg-extensions-list "css\\|js\\|png\\|jpg\\|jpeg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|otf\\|ico\\|cgi")
(setq ssg-site-dir ".")
(setq ssg-publish-dir "../../output")

(setq ssg-content
      `("ssg-content"
        :author nil
        :auto-preamble t
        :auto-sitemap t
        :base-directory ,ssg-site-dir
        :base-extension "org"
        :creator-info nil
        :exclude "family-business*"
        :exclude-tags ("noexport" "todo")
        :export-with-tags nil
        :headline-levels 6
        :html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"static/style/main.css\" />"
        ;; :html-postamble nil
        ;; :html-preamble nil
        ;; :html-style nil
        :publishing-directory ,ssg-publish-dir
        :publishing-function org-html-publish-to-html
        :recursive t
        :section-numbers nil
        ;; :sitemap-format-entry 
        :sitemap-title "Sitemap"
        :sub-superscript nil
        :table-of-contents nil
        :timestamp t
        :todo-keywords nil
        ))

(setq ssg-static
      `("ssg-static"
        :base-directory ,ssg-site-dir
        :base-extension ,ssg-extensions-list
        :include (".htaccess")
        :publishing-directory ,ssg-publish-dir
        :publishing-function org-publish-attachment
        :recursive t
        ))

(setq ssg
      '("ssg"
        :components ("ssg-content" "ssg-static")))

(setq org-publish-project-alist
      (list ssg-content ssg-static ssg))

(org-publish-project "ssg")
